import { BASE_URL } from '../services/config'
import QRCode from 'qrcode.react'
export function openUrl(item) {
    if (item.pcJumpLink) {
        window.open(item.pcJumpLink);
        return false
    } else if (item.mobileJumpLink) {
        window.open(item.mobileJumpLink);
        return false
    } else {
        return true
    }
}
export function dwDOC(pageUrl) {
    var downloadElement = document.createElement("a");
    var href =
        BASE_URL + "/uploadDownload/api/downloadFastDFS?fileUrl=" + pageUrl;
    downloadElement.target = "_blank";
    downloadElement.href = href;
    document.body.appendChild(downloadElement);
    downloadElement.click(); //点击下载
    document.body.removeChild(downloadElement); //下载完成移除元素
    window.URL.revokeObjectURL(href); //释放掉blob对象
}
export function newQRCode(newsId) {
    return (
        <div>
            <QRCode
                value={'http://kejijiangh5.cbda1984.com/newsDetails?id=' + newsId}  //value参数为生成二维码的链接
                size={100} //二维码的宽高尺寸
                fgColor="#000000"  //二维码的颜色
            />
        </div>
    );
}